<template>
	<view class="my-schedule">
		<!-- 顶部导航 -->
		<scroll-view scroll-x="true" class="scroll-content" :scroll-into-view="scrollIntoIndex">
			<view :id="'top'+index" class="scroll-item" v-for='(item,index) in topBar' :key='index'
				@tap='changeTab(index)'>
				<text :class='topBarIndex==index?"f-active-color":"f-color"'>
					{{item.name}}
				</text>
			</view>
		</scroll-view>
		<!-- 内容 -->
		<view class="my-schedule-data">
			<view v-show="topBarIndex === 0" class="my-schedule-data1">
				<view class="calendar-content">
					<uni-calendar class="uni-calendar--hook" :showMonth="false" @change="change"
						@monthSwitch="monthSwitch" :selected="selected" />
				</view>

				<view class="day-schedule" style="margin: 0 0 55px 0;">
					<uni-card :title="confirmDate">
						<uni-list v-for="item in dailyScheduleData">
							<uni-list-item class="day-schedule-item" :title='item.title'
								:note="item.beginTime+'-'+item.endTime" link
								:to="'/pages/mine/checkSchedule?id='+item.id">
							</uni-list-item>
						</uni-list>
					</uni-card>
				</view>
			</view>
			<view v-show="topBarIndex === 1" class="my-schedule-data2">
				<view>
					<ly-curriculumtable :weekTableState="true" :weekTableNumber="weekNumbers" :controlWeek="controlWeek"
						:timetableType="timetableType" :timetables="timetables" :startdDate="confirmDate"
						:weekButton="weekButton" @nextWeekClick="nextWeekClick" @lastWeekClick="lastWeekClick"
						@courseClick="courseClick" @weekSelectClick="weekSelectClick" @weekOpenClick="weekOpenClick">

					</ly-curriculumtable>
					<view style="margin: 15px 13px 20px;border: 2px solid skyblue">
						<text>“其他”是指 1.时间接近或者超过三个\n小时的日程 2. 对应位置已有日程的日程 3.时间待定的日程</text>
					</view>

				</view>
			</view>
			<view v-show="topBarIndex === 2" class="my-schedule-data3">
				<uni-search-bar @confirm="search" :focus="true" v-model="searchValue">
				</uni-search-bar>
				<!-- <uni-card v-for="card in scheduleData" :title="card"> -->
				<uni-list v-for="item in searchScheduleData">
					<uni-list-item class="day-schedule-item" :title='item.title'
						:note="item.date+'&nbsp&nbsp'+item.beginTime+'-'+item.endTime" :time='item.location'
						:to="'/pages/mine/checkSchedule?id='+item.id"></uni-list-item>
				</uni-list>
				<view>
					<uni-load-more :status=status @clickLoadMore="loadMore"></uni-load-more>
				</view>
				<!-- </uni-card> -->
			</view>
		</view>

		<!-- 悬浮加号按钮 -->
		<uni-fab ref="fab" :pattern="pattern" horizontal="right" :popMenu="popMenu" @fabClick="fabClick" />
	</view>
</template>

<script>
	import dailySchedule from '../../components/dailySchedule.vue' /* 引入组件 */ ;

	function removeDate(date) {
		if (typeof date !== 'string') {
			return
		}
		var n = date.split(" ")
		var result = n[1]
		return result
	};

	function removeTime(date) {
		if (typeof date !== 'string') {
			return
		}
		var n = date.split(" ")
		var result = n[0]
		return result
	};
	export default {

		data() {
			return {
				/* 选中的索引 */
				topBarIndex: 0,
				/* 顶栏跟随的索引id值 */
				scrollIntoIndex: 'top0',
				/* 索引内容 */
				topBar: [{
						name: '月'
					},
					{
						name: '周'
					},
					{
						name: '日'
					}
				],
				popMenu: false,
				pattern: {
					color: '#7A7E83',
					backgroundColor: '#fff',
					selectedColor: '#007AFF',
					buttonColor: '#007AFF',
					iconColor: '#fff'
				},
				/* 目前用户id */
				uid: 1,
				apiUrl: "http://localhost:8080/",
				/* 月日历 */
				currentDate: '',
				/* 当前日期 */
				confirmDate: '',
				/* 选择的日期 */
				/* 选中日期的日程数据 */
				dailyScheduleData: [],
				/* 显示当日有日程 */
				selected: [],
				searchValue: '',
				/* 搜索日程 */
				searchScheduleData: [],
				pageNum: 0,
				pageSize: 10,
				scheduleData: [],
				status: "more",
				end: false,
				count: 0,
				/* 周 */
				weekNumbers: 1, //一共显示几周
				controlWeek: 1, //显示的第几周
				weekButton: false, //开启上一周下一周按钮
				timetables: [
					['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17',
						'18', '19', '20', '21', '22', '23', '24', '25'
					],
					['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
						'', ''
					],
					['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
						'', ''
					],
					['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
						'', ''
					],
					['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
						'', ''
					],
					['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
						'', ''
					],
					['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
						'', ''
					],
				],
				timetablesId: [
					['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
						'', ''
					],
					['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
						'', ''
					],
					['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
						'', ''
					],
					['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
						'', ''
					],
					['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
						'', ''
					],
					['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
						'', ''
					],
					['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
						'', ''
					],
				],
				timeTableBeginTime: [
					['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
						'', ''
					],
					['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
						'', ''
					],
					['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
						'', ''
					],
					['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
						'', ''
					],
					['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
						'', ''
					],
					['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
						'', ''
					],
					['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
						'', ''
					],
				],
				timeTableEndTime: [
					['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
						'', ''
					],
					['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
						'', ''
					],
					['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
						'', ''
					],
					['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
						'', ''
					],
					['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
						'', ''
					],
					['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
						'', ''
					],
					['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
						'', ''
					],
				],
				timeTableExtraTime: [
					[],
					[],
					[],
					[],
					[],
					[],
					[]
				],
				timeTableDayTime: [
					[],
					[],
					[],
					[],
					[],
					[],
					[]
				],
				timetableType: [{
						index: '0',
						name: '全天'
					},
					{
						index: '1',
						name: '00:00\n01:00'
					},
					{
						index: '2',
						name: '01:00\n02:00'
					},
					{
						index: '3',
						name: '02:00\n03:00'
					},
					{
						index: '4',
						name: '03:00\n04:00'
					},
					{
						index: '5',
						name: '04:00\n05:00'
					},
					{
						index: '6',
						name: '05:00\n06:00'
					},
					{
						index: '7',
						name: '06:00\n07:00'
					},
					{
						index: '8',
						name: '07:00\n08:00'
					},
					{
						index: '9',
						name: '08:00\n09:00'
					},
					{
						index: '10',
						name: '09:00\n10:00'
					},
					{
						index: '11',
						name: '10:00\n11:00'
					},
					{
						index: '12',
						name: '11:00\n12:00'
					},
					{
						index: '13',
						name: '12:00\n13:00'
					},
					{
						index: '14',
						name: '13:00\n14:00'
					},
					{
						index: '15',
						name: '14:00\n15:00'
					},
					{
						index: '16',
						name: '15:00\n16:00'
					},
					{
						index: '17',
						name: '16:00\n17:00'
					},
					{
						index: '18',
						name: '17:00\n18:00'
					},
					{
						index: '19',
						name: '18:00\n19:00'
					},
					{
						index: '20',
						name: '19:00\n20:00'
					},
					{
						index: '21',
						name: '20:00\n21:00'
					},
					{
						index: '22',
						name: '21:00\n22:00'
					},
					{
						index: '23',
						name: '22:00\n23:00'
					},
					{
						index: '24',
						name: '23:00\n24:00'
					},
					{
						index: '25',
						name: '其他'
					},
				],
				weekIndex: 0,
				//弹窗属性
				showMyModal: false, //课程详情弹窗
				modalIcon: ['calendar', 'home', 'server-man', 'clock'], //图标
				modalItem: [], //依次是课程名、教室、教师、上课时间--为了适配渲染

			}
		},
		onLoad() {
			/* 数据传值 */
			console.log('onload')
			this.showMonthData()
		},
		onReady() {

		},
		created() {
			console.log('created')
			this.initData()
		},
		onShow() {
			/* 刷新 */
			console.log('onShow')
			this.showMonthData()
			this.clear();
			this.searchValue = "";
			/* this.order=true; */
			this.searchDate();
			this.showWeekData()
		},
		onPullDownRefresh() { //延迟一秒刷新成功
			this.showMonthData()
			this.clear();
			this.searchValue = "";
			/* this.order=true; */
			this.searchDate();
			this.showWeekData()
			console.log('刷新'),
				setTimeout(() => {
					this.msg = 'refresh',
						uni.stopPullDownRefresh()
				}, 1000)

		},
		methods: {
			/* 周 */
			courseClick(re) {
				console.log('点击了', re)
				switch (re.week) {
					case '一':
						this.weekIndex = 0;
						break;
					case '二':
						this.weekIndex = 1;
						break;
					case '三':
						this.weekIndex = 2;
						break;
					case '四':
						this.weekIndex = 3;
						break;
					case '五':
						this.weekIndex = 4;
						break;
					case '六':
						this.weekIndex = 5;
						break;
					case '七':
						this.weekIndex = 6;
						break;
				}
				var index = re.index - 1;
				var itemList = [];
				var itemId = [];
				if (index == 0) {
					console.log('全天日程', this.timeTableDayTime[this.weekIndex])
					for (var i = 0; i < this.timeTableDayTime[this.weekIndex].length; i++) {
						var id = this.timeTableDayTime[this.weekIndex][i].id;
						var title = this.timeTableDayTime[this.weekIndex][i].title;
						var beginTime = this.timeTableDayTime[this.weekIndex][i].beginTime;
						var endTime = this.timeTableDayTime[this.weekIndex][i].endTime;
						var item = '标题：' + title + '，时间：' + beginTime + '-' + endTime
						itemList.push(item)
						itemId.push(id)
						console.log(id, title, beginTime, endTime)
					}
				} else if (index == 25) {
					console.log('其他日程', this.timeTableExtraTime[this.weekIndex])
					for (var i = 0; i < this.timeTableExtraTime[this.weekIndex].length; i++) {
						var id = this.timeTableExtraTime[this.weekIndex][i].id;
						var title = this.timeTableExtraTime[this.weekIndex][i].title;
						var beginTime = this.timeTableExtraTime[this.weekIndex][i].beginTime;
						var endTime = this.timeTableExtraTime[this.weekIndex][i].endTime;
						var item = '标题：' + title + '，时间：' + beginTime + '-' + endTime
						itemList.push(item)
						itemId.push(id)
						console.log(id, title, beginTime, endTime)
					}
				} else {
					var id = this.timetablesId[this.weekIndex][index];
					var title = this.timetables[this.weekIndex][index];
					var beginTime = this.timeTableBeginTime[this.weekIndex][index];
					var endTime = this.timeTableEndTime[this.weekIndex][index];
					var item = '标题：' + title + '，时间：' + beginTime + '-' + endTime
					itemList.push(item)
					itemId.push(id)
					console.log(id, title, beginTime, endTime)
				}
				if (id != "") {
					uni.showActionSheet({
						itemList: itemList,
						success(res) {
							console.log(res.tapIndex)
							var id = itemId[res.tapIndex]
							uni.navigateTo({
								url: '/pages/mine/checkSchedule?id=' + id
							})
						},
						fail(res) {
							// 取消后的操作
						}
					})
				}

			},
			nextWeekClick(e) {
				console.log("下一周", e)
			},
			lastWeekClick(e) {
				console.log("上一周", e)
			},
			weekOpenClick() {
				console.log("点击了第几周")
			},
			weekSelectClick(e) {
				console.log("您选择了", e)
			},
			//关闭弹窗
			closeModal() {
				this.showMyModal = this.showMyModal == true ? false : true;
			},
			//返回颜色
			colorList() {
				return [
					"#ffffff", //0
					"#ffaa00", //1
					"#33CC99", //2
					"#ff5500", //3
					"#789262", //4
					"#66CCCC", //5
					"#9999FF", //6
				]
			},
			processWeekData(weekSchedules) {
				console.log("处理周数据", weekSchedules);
				var count = 0;
				var extraCount = 1;
				var weekCount = 0;
				var dayCount = 1;
				for (let key in weekSchedules) {
					console.log("属性：" + key + ",值：" + weekSchedules[key]);
					if (weekSchedules[key] != "") {
						var weekSchedule = weekSchedules[key];
						for (var i = 0; i < weekSchedule.length; i++) {
							var id = weekSchedule[i].id
							var title = weekSchedule[i].title
							var beginTime = weekSchedule[i].beginTime
							var endTime = weekSchedule[i].endTime
							if (beginTime == '未知' || endTime == '未知') {
								continue
							}
							var beginNum = beginTime.substring(0, 2)
							var endNum = endTime.substring(0, 2)
							if (Number(endNum) - Number(beginNum) == 24) {
								/* 全天放第一个格子 */
								this.timetablesId[weekCount][0] = this.timetablesId[weekCount][0] + id + '/';
								this.timetables[weekCount][0] = "此处\n" + dayCount + "\n个日程";
								dayCount++;
								this.timeTableDayTime[weekCount].push({
									"id": id,
									"title": title,
									"beginTime": beginTime,
									"endTime": endTime
								})
							} else if (Number(endNum) - Number(beginNum) > 3) {
								/* 大于3放最后一个格子 */
								this.timetablesId[weekCount][25] = this.timetablesId[weekCount][25] + id + '/';
								this.timetables[weekCount][25] = "此处\n" + extraCount + "\n个日程";
								extraCount++;
								this.timeTableExtraTime[weekCount].push({
									"id": id,
									"title": title,
									"beginTime": beginTime,
									"endTime": endTime
								})
							} else {
								var isExtra = 0;
								for (var j = 0; j <= Number(endNum) - Number(beginNum); j++) {
									if (this.timetables[weekCount][Number(beginNum) + 1 + j] == '') {
										continue;
									} else {
										isExtra = 1;
										break;
									}
								}
								if (isExtra == 1) {
									this.timetablesId[weekCount][25] = this.timetablesId[weekCount][25] + id +
										'/'; /* 格子不为空放最后一个格子 */
									this.timetables[weekCount][25] = "此处\n" + extraCount + "\n个日程";
									extraCount++;
									this.timeTableExtraTime[weekCount].push({
										"id": id,
										"title": title,
										"beginTime": beginTime,
										"endTime": endTime
									})
								} else {
									for (var j = 0; j <= Number(endNum) - Number(beginNum); j++) {
										this.timetablesId[weekCount][Number(beginNum) + 1 + j] = id;
										this.timetables[weekCount][Number(beginNum) + 1 + j] = title;
										this.timeTableBeginTime[weekCount][Number(beginNum) + 1 + j] = beginTime;
										this.timeTableEndTime[weekCount][Number(beginNum) + 1 + j] = endTime;
									}
								}
							}
						}
					}
					dayCount = 1;
					weekCount++;
					count++;
					extraCount = 1;
				};
			},
			showWeekData() {
				console.log('请求“周”数据', this.confirmDate)
				var weekSchedules = {};
				var weekSchedule = [];
				uni.request({
					url: this.apiUrl + 'schedule/getWeek',
					header: {
						Authorization: uni.getStorageSync("token")
					},
					method: 'GET',
					data: {
						uid: this.uid,
						date: this.confirmDate
					},
					success: (res) => {
						console.log('请求远程周数据')
						weekSchedules = res.data;
						console.log("周日程", weekSchedules);
						var t = uni.getStorageSync(this.uid + 'weekSchedule' + this.confirmDate);
						console.log(t)
						uni.setStorageSync(this.uid + 'weekSchedule' + this.confirmDate, weekSchedules)
						this.processWeekData(weekSchedules)
					},
					fail: (err) => {
						console.log('请求本地周数据')
						weekSchedules = uni.getStorageSync(this.uid + 'weekSchedule' + this.confirmDate);
						console.log("周日程", weekSchedules);
						this.processWeekData(weekSchedules)
					}
				});
			},
			showMonthData() {
				uni.request({
					url: this.apiUrl + 'schedule',
					method: 'GET',
					header: {
						Authorization: uni.getStorageSync("token")
					},
					data: {
						uid: this.uid,
						date: this.confirmDate
					},
					
					success: (res) => {
						console.log('请求远程月数据')
						this.dailyScheduleData = res.data.records;
						uni.setStorageSync(this.uid + 'dailySchedule' + this.confirmDate, this
							.dailyScheduleData)
					},
					fail: (err) => {
						console.log('请求本地月数据')
						this.dailyScheduleData = uni.getStorageSync(this.uid + 'dailySchedule' + this
							.confirmDate)
					}
				});
			},

			initData() {
				console.log('获得当前日期')
				var now = new Date();
				var year = now.getFullYear(); //得到年份
				var month = now.getMonth(); //得到月份
				var date = now.getDate(); //得到日期
				month = month + 1;
				if (month < 10) month = "0" + month;
				if (date < 10) date = "0" + date;
				this.currentDate = year + "-" + month + "-" + date;
				this.confirmDate = year + "-" + month + "-" + date;
				console.log("当前日期", this.currentDate);
				this.showMonthData()
			},
			changeTab(index) {
				if (this.topBarIndex == index) {
					return;
				}
				this.topBarIndex = index;
				this.scrollIntoIndex = 'top' + index;
				if (index == 1) {

				}
			},
			onChangeTab(e) {
				this.changeTab('tap', e.detail.current)
			},
			fabClick() {
				uni.navigateTo({
					url: "/pages/mine/addSchedule?time=" + this.confirmDate
				})
			},
			change(e) {
				var year = e.year; //得到年份
				var month = e.month; //得到月份
				var date = e.date; //得到日期
				if (date < 10) date = "0" + date;
				var time = year + "-" + month + "-" + date;
				/* 	this.time = time; */
				this.confirmDate = time
				console.log('选定的日期改变', this.confirmDate)
				this.clear()
				this.showMonthData()
				this.showWeekData()
				console.log('周开始时间', this.confirmDate)

			},
			monthSwitch(e) {

			},
			loadMore() {
				if (this.end) return;
				this.pageNum += 1;
				this.searchDate();
			},
			search(res) {
				console.log("搜素内容是", this.searchValue)
				this.clear()
				this.searchDate()
			},
			clear() {
				this.status = "more";
				this.searchScheduleData = [];
				this.selected = [],
					this.pageNum = 0;
				this.count = 0;
				this.end = false;
				this.weekNumbers = 1; //一共显示几周
				this.controlWeek = 1; //显示的第几周
				this.weekButton = false; //开启上一周下一周按钮
				this.timetables = [
					['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
						'', ''
					],
					['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
						'', ''
					],
					['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
						'', ''
					],
					['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
						'', ''
					],
					['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
						'', ''
					],
					['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
						'', ''
					],
					['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
						'', ''
					],
				];
				this.timetablesId = [
					['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
						'', ''
					],
					['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
						'', ''
					],
					['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
						'', ''
					],
					['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
						'', ''
					],
					['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
						'', ''
					],
					['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
						'', ''
					],
					['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
						'', ''
					],
				];
				this.timeTableBeginTime = [
					['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
						'', ''
					],
					['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
						'', ''
					],
					['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
						'', ''
					],
					['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
						'', ''
					],
					['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
						'', ''
					],
					['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
						'', ''
					],
					['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
						'', ''
					],
				];
				this.timeTableEndTime = [
					['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
						'', ''
					],
					['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
						'', ''
					],
					['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
						'', ''
					],
					['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
						'', ''
					],
					['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
						'', ''
					],
					['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
						'', ''
					],
					['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
						'', ''
					],
				];
				this.timeTableExtraTime = [
					[],
					[],
					[],
					[],
					[],
					[],
					[]
				];
				this.timeTableDayTime = [
					[],
					[],
					[],
					[],
					[],
					[],
					[]
				];
				this.timetableType = [{
						index: '0',
						name: '全天'
					},
					{
						index: '1',
						name: '00:00\n01:00'
					},
					{
						index: '2',
						name: '01:00\n02:00'
					},
					{
						index: '3',
						name: '02:00\n03:00'
					},
					{
						index: '4',
						name: '03:00\n04:00'
					},
					{
						index: '5',
						name: '04:00\n05:00'
					},
					{
						index: '6',
						name: '05:00\n06:00'
					},
					{
						index: '7',
						name: '06:00\n07:00'
					},
					{
						index: '8',
						name: '07:00\n08:00'
					},
					{
						index: '9',
						name: '08:00\n09:00'
					},
					{
						index: '10',
						name: '09:00\n10:00'
					},
					{
						index: '11',
						name: '10:00\n11:00'
					},
					{
						index: '12',
						name: '11:00\n12:00'
					},
					{
						index: '13',
						name: '12:00\n13:00'
					},
					{
						index: '14',
						name: '13:00\n14:00'
					},
					{
						index: '15',
						name: '14:00\n15:00'
					},
					{
						index: '16',
						name: '15:00\n16:00'
					},
					{
						index: '17',
						name: '16:00\n17:00'
					},
					{
						index: '18',
						name: '17:00\n18:00'
					},
					{
						index: '19',
						name: '18:00\n19:00'
					},
					{
						index: '20',
						name: '19:00\n20:00'
					},
					{
						index: '21',
						name: '20:00\n21:00'
					},
					{
						index: '22',
						name: '21:00\n22:00'
					},
					{
						index: '23',
						name: '22:00\n23:00'
					},
					{
						index: '24',
						name: '23:00\n24:00'
					},
					{
						index: '25',
						name: '其他'
					},
				];
				this.weekIndex = 0;
			},
			searchDate() {
				uni.request({
					url: this.apiUrl + 'schedule',
					method: 'GET',
					header: {
						Authorization: uni.getStorageSync("token")
					},
					data: {
						uid: this.uid,
						keyword: this.searchValue,
						pageNum: this.pageNum,
						pageSize: this.pageSize
					},
					success: (res) => {
						console.log("请求远程搜索数据")
						console.log(res.data)
						console.log('搜索日程', res.data.records);
						let schedules = res.data.records
						let size = schedules.length;
						for (var i = 0; i < size; i++, this.count++) {
							this.searchScheduleData.push({
								"id": schedules[i].id,
								"title": schedules[i].title,
								"date": schedules[i].date,
								"beginTime": schedules[i].beginTime,
								"endTime": schedules[i].endTime
							});
						}

						if (size < this.pageSize) {
							this.end = true;
							this.status = "no-more";
						}
						uni.stopPullDownRefresh()
					},
					fail: (err) => {
						console.log("请求本地搜索数据")

					}

				});
			}
		}
	}
</script>

<style scoped>
	@import "../../style/common.css";

	.my-schedule {
		display: flex;
		justify-content: center;
		width: 750rpx;
		flex-direction: column;
		justify-content: flex-start;
		/* min-width: 300px;
		max-width: 540px; */
		/* margin: 5px auto; */
	}

	.scroll-content {
		width: 750rpx;
		height: 80rpx;
		white-space: nowrap;
		display: flex;
		text-align: center;
	}

	.scroll-item {
		display: inline-block;
		padding: 10rpx 30rpx;
		font-size: 36rpx;
		width: 100rpx;
		font-size: 85%;

	}

	.f-active-color {
		padding: 10rpx 0;
		border-bottom: 6rpx solid #49bdfb;

	}

	.day-schedule-item {
		margin: 5px 15px;
	}
</style>
<!-- 加号悬停效果 -->
<style lang="scss">
	.warp {
		padding: 10px;
	}

	.button {
		margin-bottom: 10px;
	}

	.example-body {
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex-direction: row;
	}

	.calendar-button {
		flex: 1;
		font-weight: bold;
		font-size: 32rpx;
	}
</style>
